home *** CD-ROM | disk | FTP | other *** search
- Path: I980.ssi.stratus.com!not-for-mail
- From: davidm@ssi.stratus.com ()
- Newsgroups: comp.lang.c++
- Subject: function pointer in C++
- Date: 6 Feb 1996 15:16:53 GMT
- Organization: Stratus Computer Inc, Marlboro MA
- Message-ID: <4f7rd5$6ha@transfer.stratus.com>
- Reply-To: David_McReynolds@vos.stratus.com
- NNTP-Posting-Host: i980.ssi.stratus.com
- X-Newsreader: TIN [UNIX 1.3 950515BETA PL0]
-
- I have read the FAQ but do not have it in front of me right now. If
- this question appears in it, my apologies.
-
- I am involved with a project to port a ton of C (ANSI and K&R) to
- C++. This is the first step in migration to an OO architecture.
-
- The previous programmer used a typedef for a pointer to a function
- returning void that looks like this:
-
- typedef void (*PFV)();
-
- It is used repeatedly through out the code to point to functions
- that require arguements. The compiler complains about the mismatch
- in the arguement list Ex:
-
- static void call_thru (int argc, char *argv[]);
-
- PFV netx_entry_point = call_thru;
-
- (Note: they are not all just (int, char**)).
-
- I have gone through most of the code and removed the declarations
- involving PFV and replaced with something like:
-
- void (*netx_entry_point(int, char**) = call_thru;
-
- I would like to know if there is a more elegant or perhaps just plain
- better way to handle this that is not obvious to me.
-
- Thanks,
-
-